<?php

namespace IMT\EventBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class MeetingGeneralType extends AbstractType
{
	public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
	        ->add('id', 'hidden')
            ->add('title', 'text', array(
                'label'  => 'Titre de votre évènement',
            ))
            ->add('allDay', 'checkbox', array(
            		'required' => false
            ))
            ->add('date', 'datetime', array(
                'label'        => 'Date de début',
            ))
            ->add('datefin', 'datetime', array(
                'label'        => 'Date de fin',
            ))
          
            ->add('content', 'textarea', array(
                'label'  => 'Description',
                'attr'  => array(
                    'class' => 'input-xlarge',
                	'rows'  => 3
                ),
				'required' => false
            ))
            ->add('accounts', 'entity', array(
            	'class' => 'IMTAccountBundle:Account',
            	'property' => 'title',
                'multiple'     => true,
                'expanded'     => false,
            	'query_builder' => function($er) {
            		return $er->createQueryBuilder('a')->orderBy('a.title', 'ASC');
            	},
                'label'  => 'Comptes',
				'required' => false
            ))
        ;
    }

    public function getName()
    {
        return 'imt_event_form_general';
    }
	
}
